<template>
    <div id="app">
      <el-form ref="update-member" :model="member" label-width="100px">
        <el-form-item label="姓名">
          <el-input v-model="member.name" placeholder="请输入名称"></el-input>
        </el-form-item>
        <el-form-item label="电话">
          <el-input v-model="member.tel" placeholder="请输入名称"></el-input>
        </el-form-item>
        <el-form-item label="性别">
          <el-radio-group v-model="member.gender">
            <el-radio label="1">男</el-radio>
            <el-radio label="0">女</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="销售人员">
          <el-select v-model="member.saleman" placeholder="请选择">
            <el-option
              v-for="item in empList"
              :key="item.id"
              :label="item.name"
              :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="年龄">
          <el-input v-model="member.age" ></el-input>
        </el-form-item>
        <el-form-item label="描述">
          <el-input v-model="member.description"  type="textarea" rows="5"></el-input>
        </el-form-item>
        <el-form-item label="会员结束时间">
          <el-date-picker
            v-model="member.endDate"
            type="date"
            placeholder="选择时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="save()">提交</el-button>
        </el-form-item>
      </el-form>
    </div>
</template>

<script>
    export default {
      data(){
        return {
          member:{},
          empList:[]
        }
      },
      created() {
        this.axios.get("/emp/selectSaleman").then((resp)=>{
          this.empList=resp.data;
        });
        this.axios.get("/member/selectOne/"+this.$route.query.id).then((resp)=>{
          this.member=resp.data;
        });
      },
      methods:{
        save(){
          //发出ajax请求
          this.axios.put("/member/update",this.member).then((resp)=>{
            this.$router.push("/member/MemberList");
          })
        }
      }
    }
</script>


<style scoped>

</style>
